import React, { memo } from 'react'
import type { FC, ReactNode } from 'react'
import { CommentFormWrapper } from './style'
import { getSizeImage } from '@/utils/format-utils'
import TextArea from 'antd/es/input/TextArea'

interface IProps {
  children?: ReactNode
  handle: () => void
}

const CommentForm: FC<IProps> = (props) => {
  const defaultImg = 'https://i.ibb.co/DYwLdM9/header-1af6756a.png'
  const picUrl = defaultImg
  const { handle } = props
  const Editor = () => (
    <TextArea
      id="my-input"
      className="textArea"
      placeholder="评论..."
      rows={4}
    />
  )
  const handleLogin = () => {}
  return (
    <CommentFormWrapper>
      <div className="image">
        <img src={getSizeImage(picUrl, 50)} alt="" />
      </div>
      <div
        className="form"
        onClick={(e) => {
          handleLogin()
        }}
      >
        <div className="input">
          <Editor />
        </div>
        <div className="form-control">
          <div className="left-icon">
            <div className="express sprite_icon2"></div>
            <div className="ai-te sprite_icon2"></div>
          </div>
          <div className="button sprite_button2" onClick={handle}>
            评论
          </div>
        </div>
      </div>
    </CommentFormWrapper>
  )
}

export default memo(CommentForm)
